
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<HTML>

<HEAD>
   <TITLE>bodc2s_c</TITLE>
</HEAD>

<BODY style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<A name="TOP"></A>

<table style="text-align: left; margin-left: auto; margin-right: auto; width: 800px;"
 border="0" cellpadding="5" cellspacing="2">
  <tbody>
    <tr>
      <td style="background-color: rgb(153, 153, 153); vertical-align: middle; text-align: center;">
      <div align="right"> 
      <small><small><a href="index.html">Index Page</a></small></small>
      </div>
      <b>bodc2s_c</b> </td>
    </tr>

    <tr>
      <td style="vertical-align: top;">

<small><div align="center">
<A HREF="index.html#A">A</A>&nbsp;
<A HREF="index.html#B">B</A>&nbsp;
<A HREF="index.html#C">C</A>&nbsp;
<A HREF="index.html#D">D</A>&nbsp;
<A HREF="index.html#E">E</A>&nbsp;
<A HREF="index.html#F">F</A>&nbsp;
<A HREF="index.html#G">G</A>&nbsp;
<A HREF="index.html#H">H</A>&nbsp;
<A HREF="index.html#I">I</A>&nbsp;
<A HREF="index.html#J">J</A>&nbsp;
<A HREF="index.html#K">K</A>&nbsp;
<A HREF="index.html#L">L</A>&nbsp;
<A HREF="index.html#M">M</A>&nbsp;
<A HREF="index.html#N">N</A>&nbsp;
<A HREF="index.html#O">O</A>&nbsp;
<A HREF="index.html#P">P</A>&nbsp;
<A HREF="index.html#Q">Q</A>&nbsp;
<A HREF="index.html#R">R</A>&nbsp;
<A HREF="index.html#S">S</A>&nbsp;
<A HREF="index.html#T">T</A>&nbsp;
<A HREF="index.html#U">U</A>&nbsp;
<A HREF="index.html#V">V</A>&nbsp;
<A HREF="index.html#W">W</A>&nbsp;
<A HREF="index.html#X">X</A>&nbsp;
</div></small>
       <br>
       <table style="text-align: left; width: 60%; margin-left: auto; margin-right: auto;"
       border="0" cellspacing="2" cellpadding="2">
        <tbody>
          <tr>
            <td style="width: 50%; text-align: center;">
            <small>
              <a href="#Procedure">Procedure<br></a>
              <a href="#Abstract">Abstract<br></a>
              <a href="#Required_Reading">Required_Reading<br></a>
              <a href="#Keywords">Keywords<br></a>
              <a href="#Brief_I/O">Brief_I/O<br></a>
              <a href="#Detailed_Input">Detailed_Input<br></a>

              </small>
              </td>
              <td style="vertical-align: top; width: 50%; text-align: center;">
              <small>               <a href="#Detailed_Output">Detailed_Output<br></a>
              <a href="#Parameters">Parameters<br></a>
              <a href="#Exceptions">Exceptions<br></a>
              <a href="#Files">Files<br></a>
              <a href="#Particulars">Particulars<br></a>
              <a href="#Examples">Examples<br></a>

              </small>
              </td>
              <td style="vertical-align: top; width: 50%; text-align: center;">
              <small>               <a href="#Restrictions">Restrictions<br></a>
              <a href="#Literature_References">Literature_References<br></a>
              <a href="#Author_and_Institution">Author_and_Institution<br></a>
              <a href="#Version">Version<br></a>
              <a href="#Index_Entries">Index_Entries<br></a>
             </small>
            </td>
          </tr>
        </tbody>
</table>

<h4><a name="Procedure">Procedure</a></h4>
<PRE>
   void bodc2s_c ( SpiceInt        code,
                   SpiceInt        lenout,
                   SpiceChar     * name )

</PRE>
<h4><a name="Abstract">Abstract</a></h4>
<PRE>
   Translate a body ID code to either the corresponding name or if no
   name to ID code mapping exists, the string representation of the 
   body ID value.
</PRE>
<h4><a name="Required_Reading">Required_Reading</a></h4>
<PRE>
   <a href="../req/naif_ids.html">NAIF_IDS</a>
</PRE>
<h4><a name="Keywords">Keywords</a></h4>
<PRE>
   BODY
   CONVERSION


</PRE>
<h4><a name="Brief_I/O">Brief_I/O</a></h4>
<PRE>
   Variable  I/O  Description
   --------  ---  --------------------------------------------------
   code       I   Integer ID code to translate to a string.
   lenout     I   Maximum length of output name.
   name       O   String corresponding to 'code'.
 </PRE>
<h4><a name="Detailed_Input">Detailed_Input</a></h4>
<PRE>
   code        the integer code for a body: planet, satellite, 
               barycenter, spacecraft, asteroid, comet, or 
               other ephemeris object.

   lenout      is the maximum allowed length of the output name,
               including the terminating null character.  For example,
               if the caller wishes to be able to accept a 32-character
               name, lenout must be set to (at least) 33. The current
               maximum name length is 32 characters, so a value of 33
               for lenout will suffice.
</PRE>
<h4><a name="Detailed_Output">Detailed_Output</a></h4>
<PRE>
   name        the string name of the body identified by 'code'
               if a mapping between 'code' and a body name exists
               within SPICE.

               If 'code' has more than one translation, then the
               most recently defined 'name' corresponding to 'code'
               is returned. 'name' will have the exact format (case
               and blanks) as when the name/code pair was defined.

               If the input value of 'code' does not map to a body
               name, 'name' returns with the string representation
               of 'code'.
</PRE>
<h4><a name="Parameters">Parameters</a></h4>
<PRE>
   None.
</PRE>
<h4><a name="Exceptions">Exceptions</a></h4>
<PRE>
   1) If the output string pointer is null, the error SPICE(NULLPOINTER)
      is signaled.
   
   2) If the output string has length less than two characters, it 
      is too short to contain one character of output data plus a null  
      terminator, so it cannot be passed to the underlying Fortran 
      routine.  In this event, the error SPICE(STRINGTOOSHORT) is
      signaled.
 </PRE>
<h4><a name="Files">Files</a></h4>
<PRE>
   Body-name mappings may be defined at run time by loading text
   kernels containing kernel variable assignments of the form

      NAIF_BODY_NAME += ( &lt;name 1&gt;, ... )
      NAIF_BODY_CODE += ( &lt;code 1&gt;, ... )

   See NAIF_ID.REQ for details.
</PRE>
<h4><a name="Particulars">Particulars</a></h4>
<PRE>
   <b>bodc2s_c</b> is one of five related subroutines,

      <a href="bods2c_c.html">bods2c_c</a>      Body string to code
      <b>bodc2s_c</b>      Body code to string
      <a href="bodn2c_c.html">bodn2c_c</a>      Body name to code
      <a href="bodc2n_c.html">bodc2n_c</a>      Body code to name
      <a href="boddef_c.html">boddef_c</a>      Body name/code definition

   <a href="bods2c_c.html">bods2c_c</a>, <b>bodc2s_c</b>, <a href="bodn2c_c.html">bodn2c_c</a>, and <a href="bodc2n_c.html">bodc2n_c</a> perform translations between 
   body names and their corresponding integer ID codes which are 
   used in SPICE files and routines.

   <a href="bods2c_c.html">bods2c_c</a> is a slightly more general version of <a href="bodn2c_c.html">bodn2c_c</a>: support
   for strings containing ID codes in string format enables a caller
   to identify a body using a string, even when no name is
   associated with that body.

   <b>bodc2s_c</b> is a general version of <a href="bodc2n_c.html">bodc2n_c</a>; the routine returns either
   the name assigned in the body ID to name mapping or a string
   representation of the CODE value if no mapping exists.

   <a href="boddef_c.html">boddef_c</a> assigns a body name to ID mapping. The mapping has priority 
   in name-to-ID and ID-to-name translations.

   Refer to NAIF_ID.REQ for the list of name/code associations built into
   SPICE, and for details concerning adding new name/code
   associations at run time by loading text kernels.
</PRE>
<h4><a name="Examples">Examples</a></h4>
<PRE>
   Apply the BODC2S call to several IDs representing codes
   included in the default SPICE ID-name lists and codes not
   included in the list.

   #include &lt;stdio.h&gt;
   #include &quot;SpiceUsr.h&quot;
   #define  LEN               32

   int main()
      {

      /.
      Assign an array of body ID codes. Not all the listed codes
      map to a body name.
      ./

      SpiceInt                code[] = { 399, 0, 3, -77, 
                                         11, -1, 6000001 };
 
      SpiceInt                lenout = LEN;
      SpiceChar               name [LEN];
      SpiceInt                i;

      /.
      Loop over the 'code' array, call <b>bodc2s_c</b> for each
      element of 'code'.
      ./

      for (i=0; i&lt;7; i++ )
         {
         (void) <b>bodc2s_c</b> ( code[i], lenout, name );
         printf(&quot;%ld   %s\n&quot;, code[i], name);
         }

      return ( 0 );
      }

    Given these codes, <b>bodc2s_c</b> returns the following 'name' strings:

          Code        Name
          -------     -------------------
              399     'EARTH'
                0     'SOLAR SYSTEM BARYCENTER'
                3     'EARTH BARYCENTER'
              -77     'GALILEO ORBITER'
               11     '11'
               -1     'GEOTAIL'
          6000001     '6000001'

   The codes 11 and 6000001 did not map to a name so the call
   returns as 'name' the string expression of the codes.
</PRE>
<h4><a name="Restrictions">Restrictions</a></h4>
<PRE>
   None.
</PRE>
<h4><a name="Literature_References">Literature_References</a></h4>
<PRE>
   None.
</PRE>
<h4><a name="Author_and_Institution">Author_and_Institution</a></h4>
<PRE>
  E.D. Wright     (JPL)
</PRE>
<h4><a name="Version">Version</a></h4>
<PRE>
    -CSPICE Version 1.0.0, 24-APR-2010 (EDW)
</PRE>
<h4><a name="Index_Entries">Index_Entries</a></h4>
<PRE>
   body id code to string
</PRE>
<h4>Link to routine bodc2s_c source file <a href='../../../src/cspice/bodc2s_c.c'>bodc2s_c.c</a> </h4>

      </td>
    </tr>
  </tbody>
</table>

   <pre>Wed Jun  9 13:05:19 2010</pre>

</body>
</html>

